﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="create_Video.aspx.cs" Inherits="SQT.tracnghiem.Ajax.ASP.Gallery.create_Video" %>

<%@ Import Namespace="DataAccess" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<body>
    <%
        string name = Request.QueryString["name"];
        string link = Request.QueryString["link"];
        int parent = int.Parse(Request.QueryString["parent"]);

        new TblLibraryController().Insert(name, link, int.Parse(Session["admin_id"].ToString()), DateTime.Now, 3, parent, DateTime.Now, int.Parse(Session["admin_id"].ToString()), false, false);

        var get_last = new TblLibraryController().FetchAll().Last();
        var get_uploader = new TblManagerController().FetchAll().Where(x => x.ManagerId == get_last.LibraryUploader).Single();
        var get_editor = new TblManagerController().FetchAll().Where(x => x.ManagerId == get_last.LibraryEditor).Single();
        string upload_date = "", edit_date = "";
        DateTime date = DateTime.Parse(get_last.LibraryUploadDate.ToString());
        upload_date = date.Day + "/" + date.Month + "/" + date.Year + " " + date.Hour + ":" + date.Minute;
        date = DateTime.Parse(get_last.LibraryEditDate.ToString());
        edit_date = date.Day + "/" + date.Month + "/" + date.Year + " " + date.Hour + ":" + date.Minute;
    %>
    <tr id="item<%=get_last.LibraryId %>">
        <td class="gal-table-name"><span class="gal-video-link" hidden="hidden"><%=get_last.LibraryLink %></span><i onclick="gal_watch_video(this)" title="Xem video" data-toggle="tooltip" data-placement="bottom" class="fa fa-youtube-play w3-hover-text-teal"></i><span class="gal-video-name"><span class="item_name"><%=get_last.LibraryName %></span></span></td>
        <td class="gal-table-date"><span title="<%=get_uploader.FullName %>" data-toggle="tooltip" data-placement="bottom"><%=upload_date %></span></td>
        <td class="gal-table-modified"><span title="<%=get_uploader.FullName %>" data-toggle="tooltip" data-placement="bottom"><%=edit_date %></span></td>
        <td class="gal-table-options">
            <input class="gal-link-copy" id="link<%=get_last.LibraryId %>" value="https://www.youtube.com/watch?v=<%=get_last.LibraryLink %>" />
            <i onclick="gal_copy(<%=get_last.LibraryId %>)" title="Sao chép link" data-toggle="tooltip" data-placement="bottom" class="fa fa-copy w3-hover-text-teal"></i>
            <i onclick="gal_rename('<%=get_last.LibraryName %>','<%=get_last.LibraryId %>')" title="Đổi tên" data-toggle="tooltip" data-placement="bottom" class="fa fa-edit w3-hover-text-teal"></i>
            <i onclick="gal_move('<%=get_last.LibraryId %>')" title="Di chuyển" data-toggle="tooltip" data-placement="bottom" class="fa fa-external-link w3-hover-text-teal"></i>
            <i onclick="gal_delete(<%=get_last.LibraryId %>)" title="Xóa" data-toggle="tooltip" data-placement="bottom" class="fa fa-trash w3-hover-text-teal"></i>
        </td>
    </tr>
</body>
</html>
